Skip to content

gh-106318: Add examples for str.casefold() and str.lower() methods#142154

Merged
vstinner merged 6 commits intopython:mainfrom
adorilson:106318.casefold_and_lower
Jan 7, 2026
Merged

gh-106318: Add examples for str.casefold() and str.lower() methods#142154
vstinner merged 6 commits intopython:mainfrom
adorilson:106318.casefold_and_lower

Conversation

@adorilson
Copy link
Contributor

@adorilson adorilson commented Dec 1, 2025

WIP to #106318

gh-106318: Add examples for str.casefold() and str.lower() methods


📚 Documentation preview 📚: https://cpython-previews--142154.org.readthedocs.build/

lowercase letter ``'ß'`` is equivalent to ``"ss"``. Since it is already
lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:`casefold`
converts it to ``"ss"``.
converts it to ``"ss"``, as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this is a little repetitive, if one reads the sentence the example just repeats the exact same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we remove the sentence and put comments?

>>> 'ß'.casefold() # the German lowercase letter ``'ß'``
'ss'
>>> 'ß'.lower() # since it is already lowercase, lower does nothing
'ß'

Co-authored-by: Victor Stinner <vstinner@python.org>
@adorilson adorilson requested a review from vstinner January 6, 2026 21:17
Co-authored-by: Victor Stinner <vstinner@python.org>
@adorilson adorilson requested a review from vstinner January 7, 2026 11:54
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@vstinner vstinner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jan 7, 2026
@vstinner vstinner enabled auto-merge (squash) January 7, 2026 16:12
@vstinner vstinner merged commit 51a56a3 into python:main Jan 7, 2026
32 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jan 7, 2026
@miss-islington-app
Copy link

Thanks @adorilson for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 7, 2026
…ods (pythonGH-142154)

(cherry picked from commit 51a56a3)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 7, 2026
…ods (pythonGH-142154)

(cherry picked from commit 51a56a3)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Jan 7, 2026

GH-143524 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jan 7, 2026
@bedevere-app
Copy link

bedevere-app bot commented Jan 7, 2026

GH-143525 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jan 7, 2026
vstinner added a commit that referenced this pull request Jan 7, 2026
…hods (GH-142154) (#143524)

gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154)
(cherry picked from commit 51a56a3)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
vstinner added a commit that referenced this pull request Jan 7, 2026
…hods (GH-142154) (#143525)

gh-106318: Add examples for str.casefold() and str.lower() methods (GH-142154)
(cherry picked from commit 51a56a3)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@vstinner
Copy link
Member

vstinner commented Jan 7, 2026

Merged, thanks!

thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
…ods (python#142154)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants